package com.my.study.enums;

public enum BusinessExceptionEnum {

    SUCCESS("200", "操作成功"),

    SYSTEM_ERROR("500", "系统异常"),

    PERMISSION("401", "鉴权失败"),

    SC_FORBIDDEN("403", "登陆失败,禁止访问"),

    WHITE_LIST("405", "未配置白名单"),

    FAIL("400", "操作失败");

    public String code;
    public String msg;

    BusinessExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static BusinessExceptionEnum getBusinessExceptionEnum(String code) {
        for (BusinessExceptionEnum businessExceptionEnum : BusinessExceptionEnum.values()) {
            if (businessExceptionEnum.code.equals(code)) {
                return businessExceptionEnum;
            }
        }
        return BusinessExceptionEnum.FAIL;
    }
}
